<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <style>
            *{
               margin: 0px;
               padding: 0px;
               list-style: none; 
            }
            ul{
                overflow: hidden;
            }
            ul li{
                float: left;
                width:100px;
                text-align: center;
                cursor: pointer;
            }
            p{
                width:100px;
                height: 40px;
                line-height: 40px;
                text-align: center;
                display: none;
            }
            li.current{
                background:rgb(27, 185, 125);
                color:white;
            }
            p.current{
                display: block
            }
        </style>
    </head>
    <body>
        <ul>
            <li class="current">开始</li>
            <li>你喜欢什么呢</li>
            <li>你的爱好</li>
            <li>你想去哪里呢</li>
            <li>你觉得如何呢</li>
            <li>可以吗</li>
        </ul>
        <div>
            <p class="current">结束</p>
            <a href=""><p>睡觉        吃饭</p></a>
            <p>听歌    看小说    吃饭</p>
            <p>上床</p>
            <p>挺好的  非常好</p>
            <p>非常可以</p>
        </div>

        <script>
            var tags=document.getElementsByTagName('li');
            var cons=document.getElementsByTagName('p');
            for(var i=0;i<tags.length;i++){
                tags[i].zsh=i;
                tags[i].onclick=function(){
                    for(var t=0;t<tags.length;t++){
                        tags[t].className='';
                        cons[t].className='';
                    }
                    this.className="current";
                    var n=this.zsh;
                    cons[n].className='current'
                }
            }
        </script>
    </body>
</html>





